Skip to content

Conversation

Ayush1325
Copy link
Contributor

Add support for binding and accepting TCP4 connections.

While testing, the following network options were used with QEMU + OVMF: -nic user,hostfwd=tcp::12345-:12345

The default localhost address on qemu seems to be 10.0.2.15.

UEFI spec does not seem to state that the TCP Handle returned by the Accept method has a ServiceBinding Protocol. So have made the ServiceBinding Protocol optional.

cc @nicholasbishop

@rustbot
Copy link
Collaborator

rustbot commented Aug 13, 2025

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 13, 2025
@ibraheemdev
Copy link
Member

Passing this along to someone else, who hopefully has more context. r? libs

@rustbot rustbot assigned thomcc and unassigned ibraheemdev Aug 19, 2025
@Ayush1325
Copy link
Contributor Author

@rustbot label +O-UEFI

@rustbot rustbot added the O-UEFI UEFI label Aug 29, 2025
@tgross35
Copy link
Contributor

tgross35 commented Sep 3, 2025

Thom is off the review rotation
r? libs

Also gentle ping @nicholasbishop for a review since we usually defer UEFI to you

@rustbot rustbot assigned tgross35 and unassigned thomcc Sep 3, 2025
temp.configure(false, None, Some(x))?;
Ok(Tcp::V4(temp))
}
SocketAddr::V6(_) => todo!(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than todo!(), maybe add an IPV6_UNSUPPORTED error to

impl Error {
and return that

Copy link
Contributor Author

@Ayush1325 Ayush1325 Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to return normal unsupported instead of adding a new error variant. Since IPv6 is just not implemented by std right now. It is supported by UEFI. And I am planning to implement it once IPv4 is complete.

} else {
(DEFAULT_ADDR, 0)
};
let subnet_mask = helpers::ipv4_to_r_efi(crate::net::Ipv4Addr::new(255, 255, 255, 0));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a breaking change? If the mask was previously 0.0.0.0 (all addresses), it seems like this may surprise some users

Worth a comment in any case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is not a breaking change. That is because the docs state the following: Not used when UseDefaultAddress is TRUE.

And previously, UseDefaultAddress was always true.

Comment on lines +111 to +112
// The spec does not seem to state if we need to call ServiceBinding->DestroyChild for
// this handle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reference implementation that does or doesn't do this? Or a way to check whether or not the handle is valid after this call?

@@ -15,7 +15,7 @@ pub(crate) struct Tcp4 {
protocol: NonNull<tcp4::Protocol>,
flag: AtomicBool,
#[expect(dead_code)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this lint still fire?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, just tested

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 5, 2025
Add support for binding and accepting TCP4 connections.

While testing, the following network options were used with QEMU + OVMF:
-nic user,hostfwd=tcp::12345-:12345

The default localhost address on qemu seems to be 10.0.2.15.

UEFI spec does not seem to state that the TCP Handle returned by the
Accept method has a ServiceBinding Protocol. So have made the
ServiceBinding Protocol optional.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-UEFI UEFI S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants